
#include "syscall.h"
#include "stdio.h"
#include "stdlib.h"

int
main()
{
		printf("Accept test\n");
   while(1)
   {
     int fd = accept( 1 );
	 if(fd != -1)
	 {
       printf( "accept syscall returned: %d\n", fd );
		 char buf[256];
		 
		 int bytes = read(fd, buf, 256);
		 
		 while(bytes != -1)
		 {
			if(bytes > 0)
				printf("received: %s\n", buf);
			
			bytes = read(fd, buf, 256);
		 }
		 
		 
		 printf("Accept closed connection.\n");
		 close(fd);
	 
	}
   }
}
